// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 07/02/2013 05:24:27 p.m.
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   confirma.java

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Properties;
import java.util.Vector;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import kaizen.jdbc.DbAppUnivC;
import kaizen.jdbc.dbRecord;
import kaizen.nomweb.templates;
import kaizen.nomweb.utilerias;

public class confirma extends HttpServlet
{

    public confirma()
    {
        datColorRen = "";
        datFont = "";
        datTamFont = "";
        datColorFont = "";
        dirPlantillasGenerales = "";
        plant_conf = "pgral_ideograma/confirma.html";
        error = "";
    }

    public void doGet(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
        throws ServletException, IOException
    {
        httpservletresponse.setContentType("text/html");
        PrintWriter printwriter = httpservletresponse.getWriter();
        javax.servlet.http.HttpSession httpsession = httpservletrequest.getSession(false);
        String s = generaPantalla(httpservletrequest, httpservletresponse, error);
        printwriter.println(s);
    }

    public void doPost(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
        throws IOException, ServletException
    {
        doGet(httpservletrequest, httpservletresponse);
    }

    public void generaAmbiente(HttpServletRequest httpservletrequest)
        throws IOException
    {
        String s = utilerias.tomaParametro("dic_sistema", httpservletrequest);
        if(s == null)
            s = "mocte";
        String s1 = "/kaizen/" + s + "Web.properties";
        Properties properties = utilerias.loadProperties(s1);
        dirPlantillasGenerales = properties.getProperty("plantillas");
        datColorRen = properties.getProperty("datColorRen");
        datFont = properties.getProperty("datFont");
        datTamFont = properties.getProperty("datTamFont");
        datColorFont = properties.getProperty("datColorFont");
    }

    public String generaPantalla(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse, String s)
        throws IOException
    {
        String s1 = httpservletrequest.getParameter("serie");
        String s2 = httpservletrequest.getParameter("numero");
        PrintWriter printwriter = httpservletresponse.getWriter();
        generaAmbiente(httpservletrequest);
        String s3 = "";
        String s4 = "";
        String s5 = "";
        String s6 = "";
        String s7 = "";
        String s8 = "";
        String s9 = "";
        String s10 = "";
        String s11 = "";
        String s12 = " SELECT PEDI_SERIE||'-'||TO_CHAR(PEDI_NUMERO), PEDI_CLNT_NUMERO||'-'||clnt_razon_social, PROD_DESCRIPCION, \tPRPR_DESCRIPCION, PEDI_TONELADAS, TO_CHAR(DEPG_FECHA_ENVIO, 'DD/MM/YYYY')  FROM   SCC_PEDIDOS, SCC_CLIENTES, SCC_PROGRAMAS_SUGERIDOS, SCC_DETALLE_PROG_SUGERIDO, SCC_PRODUCTOS, SCC_PRESENTACIONES_PROD  WHERE  PEDI_FOIN_SERIE  = '" + s1 + "' " + " AND    PEDI_FOIN_NUMERO = " + s2 + " AND    CLNT_NUMERO      = PEDI_CLNT_NUMERO " + " AND    PRSU_PEDI_SERIE  = PEDI_SERIE " + " AND    PRSU_PEDI_NUMERO = PEDI_NUMERO " + " AND    DEPG_PRSU_NUMERO = PRSU_NUMERO " + " AND    PROD_CLAVE       = PEDI_PROD_CLAVE " + " AND    PRPR_CLAVE       = PROD_PRPR_CLAVE " + " ORDER BY PEDI_SERIE, PEDI_NUMERO ";
        Vector vector = DbAppUnivC.execQuery(s12);
        for(int i = 0; i < vector.size(); i++)
        {
            dbRecord dbrecord = (dbRecord)vector.elementAt(i);
            String s14 = dbrecord.getField(1);
            s5 = dbrecord.getField(2);
            String s16 = dbrecord.getField(3);
            String s18 = dbrecord.getField(4);
            String s19 = dbrecord.getField(5);
            String s20 = dbrecord.getField(6);
            String s21 = "";
            if(i % 2 == 1)
                s21 = datColorRen;
            else
                s21 = "#FFFFFF";
            s3 = s3 + "<tr>";
            s3 = s3 + templates.tablaCol(s14, datColorFont, datFont, datTamFont, s21);
            s3 = s3 + templates.tablaCol(s16, datColorFont, datFont, datTamFont, s21);
            s3 = s3 + templates.tablaCol(s18, datColorFont, datFont, datTamFont, s21);
            s3 = s3 + templates.tablaCol(s19, datColorFont, datFont, datTamFont, s21);
            s3 = s3 + templates.tablaCol(s20, datColorFont, datFont, datTamFont, s21);
            s3 = s3 + "</tr>";
        }

        String s13 = templates.getHost();
        String s15 = dirPlantillasGenerales + plant_conf;
        String s17 = "";
        s17 = templates.generaPlantilla(s15, s13);
        s17 = utilerias.replaceString1(s17, "--clnt--", s5);
        s17 = utilerias.replaceString1(s17, "--serie--", s1);
        s17 = utilerias.replaceString1(s17, "--numero--", s2);
        s17 = utilerias.replaceString1(s17, "--tabla--", s3);
        return s17;
    }

    String datColorRen;
    String datFont;
    String datTamFont;
    String datColorFont;
    String dirPlantillasGenerales;
    String plant_conf;
    String error;
}